﻿<UserControl x:Class="VMuktiGrid.ctlVMuktiGrid"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:nmVMuktiGrid="clr-namespace:VMuktiGrid"
    xmlns:nmPage="clr-namespace:VMuktiGrid.ctlPage"
    xmlns:nmTab="clr-namespace:VMuktiGrid.ctlTab"
    xmlns:nmBuddy="clr-namespace:VMuktiGrid.Buddy"
    xmlns:nmGrid="clr-namespace:VMuktiGrid.CustomGrid"
    xmlns:nmMenu="clr-namespace:VMuktiGrid.CustomMenu">
    
    <UserControl.Resources>
        <nmVMuktiGrid:CTabControlHeight x:Key="oTabControlHeight" />
        <nmVMuktiGrid:CTabControlWidth x:Key="oTabControlWidth" />
    </UserControl.Resources>
    
    <Grid Name="grdMain" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="Auto" Width="Auto">
        <nmPage:TabControl x:Name="pageControl" Grid.Row="1" TabStripPlacement="{Binding ElementName=listBox, Path=SelectedItem}" 
				        TabItemMinWidth="150" TabItemMaxWidth="300" TabItemMinHeight="30" TabItemMaxHeight="50" VerticalContentAlignment="Center" 
                           Width="{Binding ElementName=grdMain, Path=ActualWidth, Converter={StaticResource oTabControlWidth}}" Height="{Binding ElementName=grdMain, Path=ActualHeight, Converter={StaticResource oTabControlHeight}}">
            <nmPage:TabControl.pgTabItemNormalBackground>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <GradientStop Color="#FFFCFDFD" Offset="0"/>
                    <GradientStop Color="#FFE5EAF5" Offset="0.3"/>
                    <GradientStop Color="#FFCFD7EB" Offset="0.3"/>
                    <GradientStop Color="#FFE0E5F5" Offset="0.7"/>
                    <GradientStop Color="#FFECEEFC" Offset="1"/>
                </LinearGradientBrush>
            </nmPage:TabControl.pgTabItemNormalBackground>

            <nmPage:TabControl.pgTabItemSelectedBackground>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <GradientStop Color="#FFFBFDFE" Offset="0"/>
                    <GradientStop Color="#FFEAF6FB" Offset="0.3"/>
                    <GradientStop Color="#FFCEE7FA" Offset="0.3"/>
                    <GradientStop Color="#FFB9D1FA" Offset="1"/>
                </LinearGradientBrush>
            </nmPage:TabControl.pgTabItemSelectedBackground>

            <nmPage:TabControl.pgTabItemMouseOverBackground>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <GradientStop Color="#FFFCFDFD" Offset="0"/>
                    <GradientStop Color="#FFC6DDF7" Offset="0.3"/>
                    <GradientStop Color="#FF99C6EE" Offset="0.3"/>
                    <GradientStop Color="#FFB6D6F1" Offset="0.7"/>
                    <GradientStop Color="#FFD9E9F9" Offset="1"/>
                </LinearGradientBrush>
            </nmPage:TabControl.pgTabItemMouseOverBackground>

            <nmPage:TabItem>
                <nmPage:TabItem.Header>
                    <!--<TextBlock Text="New Tab - 0" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"/>-->
                    <nmMenu:ctlPgTabHeader Title="Default Page" />
                </nmPage:TabItem.Header>

                <nmPage:TabItem.Icon>
                    <Image Height="16" Width="16" Margin="2,0,2,0" VerticalAlignment="Center" Source="\Controls\VMuktiGrid\Images\VMuktiIcon.ico"/>
                </nmPage:TabItem.Icon>

                <nmPage:TabItem.Content>

                    <nmTab:TabControl Margin="2" x:Name="tabControl" Grid.Row="1" TabStripPlacement="{Binding ElementName=listBox, Path=SelectedItem}" 
				        TabItemMinWidth="150" TabItemMaxWidth="300" TabItemMinHeight="30" TabItemMaxHeight="50" VerticalContentAlignment="Center" >

                        <!-- Properties for setting the background for the tab items depending on their current state SizeChanged="tabControl_SizeChanged"-->
                        <!-- These brushes give the contro an IE7 type look-->
                        <nmTab:TabControl.tbTabItemNormalBackground>
                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                <GradientStop Color="#FFFCFDFD" Offset="0"/>
                                <GradientStop Color="#FFE5EAF5" Offset="0.3"/>
                                <GradientStop Color="#FFCFD7EB" Offset="0.3"/>
                                <GradientStop Color="#FFE0E5F5" Offset="0.7"/>
                                <GradientStop Color="#FFECEEFC" Offset="1"/>
                            </LinearGradientBrush>
                        </nmTab:TabControl.tbTabItemNormalBackground>

                        <nmTab:TabControl.tbTabItemSelectedBackground>
                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                <GradientStop Color="#FFFBFDFE" Offset="0"/>
                                <GradientStop Color="#FFEAF6FB" Offset="0.3"/>
                                <GradientStop Color="#FFCEE7FA" Offset="0.3"/>
                                <GradientStop Color="#FFB9D1FA" Offset="1"/>
                            </LinearGradientBrush>
                        </nmTab:TabControl.tbTabItemSelectedBackground>

                        <nmTab:TabControl.tbTabItemMouseOverBackground>
                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                <GradientStop Color="#FFFCFDFD" Offset="0"/>
                                <GradientStop Color="#FFC6DDF7" Offset="0.3"/>
                                <GradientStop Color="#FF99C6EE" Offset="0.3"/>
                                <GradientStop Color="#FFB6D6F1" Offset="0.7"/>
                                <GradientStop Color="#FFD9E9F9" Offset="1"/>
                            </LinearGradientBrush>
                        </nmTab:TabControl.tbTabItemMouseOverBackground>

                        <nmTab:TabItem>
                            <!-- SizeChanged="TabItem_SizeChanged"
						        we could use the header attribute to set the header if it is text
						        but wrapping it in a textblock gives use character ellipsis and wrapping options etc
					        -->
                            <nmTab:TabItem.Header>
                                <!--<TextBlock Text="New Tab - 0" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"/>-->
                                <nmMenu:ctlPgTabHeader Title="Default Tab" />
                            </nmTab:TabItem.Header>

                            <!-- Add an Icon to the TabItem, this con is also used in the DropDown context menu-->
                            <nmTab:TabItem.Icon>
                                <Image Source="\Controls\VMuktiGrid\Images\VMuktiIcon.ico" Height="16" Width="16" Margin="2,0,2,0" VerticalAlignment="Center"/>
                            </nmTab:TabItem.Icon>

                            <nmTab:TabItem.Content>
                                <nmGrid:ctlGrid x:Name="objGrid" />
                            </nmTab:TabItem.Content>

                        </nmTab:TabItem>
                    </nmTab:TabControl>
                </nmPage:TabItem.Content>
            </nmPage:TabItem>
        </nmPage:TabControl>
    </Grid>
</UserControl>
